package com.etbsms.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Order;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.etbsms.dao.ICodeLanguageDAO;
import com.etbsms.domain.CodeLanguage;

@Repository
@Component("codeLanguageDAO")
public class CodeLanguageDAOImpl extends GenericDAOImpl<CodeLanguage, String> 
	implements ICodeLanguageDAO {


	@Override
	@SuppressWarnings("unchecked")
	public List<CodeLanguage> getAll() {
		Session session = sessionFactory.openSession();
		Criteria criteria = session.createCriteria(CodeLanguage.class);
		criteria.addOrder(Order.asc("sort"));
		List<CodeLanguage> list = criteria.list();
		session.close();
		return list;
	}
	

}
